<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->id();
            $table->integer('book_id')->comment("书籍ID");
            $table->integer('user_id')->comment('用户ID');
            $table->integer('category_id')->comment('分类ID');
            $table->string('sn')->unique()->comment('订单号');
            $table->tinyInteger('num')->comment('数量');
            $table->tinyInteger('status')->comment('状态:0未付款1已付款2交易完成');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('orders');
    }
};
